"ui";

showLoginUI();
ui.statusBarColor("#000000")

//显示登录界面
function showLoginUI(){
    ui.layout(
      <frame>
        <vertical h="auto" align="center" margin="0 50">
          <linear>
             <text w="56" gravity="center" color="#111111" size="16">用户名</text>
             <input id="name" w="*" text="mmdzM52581112D09BF8FAFB17DC5E9FD" h="60"/>
          </linear>
          <linear>
            <text w="68" gravity="center" color="#111111" size="16">陌陌名字:</text>
            <input id="MOMOName" text="雪儿*小雪*小倩" hint="多个名字以*隔开" h="60" />
        </linear>
        <linear>
            <text w="108" gravity="center" color="#111111" size="16">回复消息3:</text>
            <input id="nameNewReply3Calls" text="兰州市汉庭酒店*呼和浩特市春雪四季酒店*青岛市城阳人民医院" hint="多条消息以*隔开" h="60" />
        </linear>
          {/* 
          <linear>
             <text w="86" gravity="center" color="#111111" size="16">涨到买卖最大值全抛</text>
             <input id="BSZmax" w="*" text="10" h="60"/>
          </linear>
          <linear>
             <text w="56" gravity="center" color="#111111" size="16">买份数</text>
             <input id="BSP" w="*" text="10" h="60"/>
          </linear>
          <linear>
             <text w="56" gravity="center" color="#111111" size="16">卖份数</text>
             <input id="SPice" w="*" text="10" h="60"/>
          </linear> */}
          <linear gravity="center">
             <button id="click_me" text="启动脚本"/>
          </linear>
        </vertical>
      </frame>
    );
}


ui.click_me.on("click", () => {
    toast("脚本启动");
    files.createWithDirs("/sdcard/2.txt");
    threads.start(Stazfb);
});
var Text2s,Text1s;
//StaWbEnd()
function Stazfb(){
    var 请求地址 = "https://w.eydata.net/3eace7224fc70986";
    var user = ui.name.getText();
    //用户名=user
    
    var 密码 = "123456";
    var Version="1.0";
    var 机器码="";
    var res = http.post(请求地址, {
        "SingleCode": user,
        "Ver":"1.0",
        "Mac":"111"
    });
    //console.log(res.body.string())
    var a=res.body.string()
    if(a.length=="32"){
        //console.log(用户名)
        console.log("启点脚本开始");
        Text1s = ui.nameReply3Calls.getText();
        launchApp("微信");
        sleep(5000);
        StaMoMoCler()
    }else{
        console.show();
        console.log("卡密错误，请联系管理员获取qq:1934215149");
    }
}
//StaMoMoCler()
// toast(1)
//开始清除陌陌数据
//StaMoMoCler()
function StaMoMoCler(){
    Text2s = ui.MOMOName.getText();
    console.show()
    try {
        let packageName = "com.immomo.momo";
        app.openAppSetting(packageName);
        console.log(packageName);
        text(app.getAppName(packageName)).waitFor();
        let is_sure = textMatches(/(.*清除.*|.*清除.*|.*清除.*|.*清除.*)/).findOne();
        if (is_sure.enabled()) {
            textMatches(/(.*清除.*|.*清除.*|.*清除.*|.*清除.*)/).findOne().click();
            textMatches(/(.*清除全部数据.*|.*清除全部数据.*)/).findOne().click();
            textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            toast(app.getAppName(packageName) + "应用已被清除全部数据");
            sleep(1000);
            back();
            sleep(5000);
            home();
            sleep(5000);
            console.log("开始卸载陌陌");
            app.uninstall("com.immomo.momo");
            sleep(2000);
            textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            sleep(5000);
            if (text("确定").exists()) {
                var qchc = text("确定").findOne()
                var x = qchc.bounds().centerX();
                var y = qchc.bounds().centerY();
                click(x, y);
                sleep(3000)
            }
            // textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            // sleep(2000);
            console.log("卸载完成");
            back();
            sleep(3000)
            home()
            sleep(3000)
            Sta360Stop()
        }
    } catch (error) {
        log("出现报错，可能陌陌已经卸载")
        Sta360Stop();
    }

}
//停止360助手
function Sta360Stop(){
    launch("com.qihoo.appstore")
    sleep(3000)
    if (text("允许").exists()) {
        var qchc = text("允许").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    sleep(5000);
    console.show()
    let packageName = "com.qihoo.appstore";
    app.openAppSetting(packageName);
    text(app.getAppName(packageName)).waitFor();
    let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
    if (is_sure.enabled()) {
        textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
        textMatches(/(.*确.*|.*定.*)/).findOne().click();
        toast(app.getAppName(packageName) + "应用已被关闭");
        sleep(1000);
        back();
        sleep(5000);
        StaWeiba()
    }
}
//开始打开微霸并且抹除APP内容加新机
function StaWeiba(){
    let packageName = "com.miui.miuibbs";
    app.openAppSetting(packageName);
    text(app.getAppName(packageName)).waitFor();
    let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
    if (is_sure.enabled()) {
        textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
        textMatches(/(.*确.*|.*定.*)/).findOne().click();
        toast(app.getAppName(packageName) + "应用已被关闭");
        sleep(1000);
        back();
        sleep(5000);
    }
    launch("com.miui.miuibbs");
    sleep(18000)
    if (text(" 首页").exists()) {
        var qchc = text(" 首页").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        console.log("首页");
        sleep(5000);
    }
    log("抹除APP");
    if (text(" 抹除APP").exists()) {
        var qchc = text(" 抹除APP").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        console.log("抹除APP");
        sleep(5000);
        console.hide();
        setText("360")
        sleep(6000);
    }
    if (text("360手机助手").exists()) {
        var qchc = text("360手机助手").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("确定").exists()) {
        var qchc = text("确定").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        back()
        sleep(3000)
    }
    if (text(" 一键改机").exists()) {
        var qchc = text(" 一键改机").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("伪装成新设备").exists()) {
        var qchc = text("伪装成新设备").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(18000)
        home();
        StaXiaMoMo();
    }
    back()
    sleep(3000)
    StaWeiba()
}
//开始下载陌陌
function StaXiaMoMo(){
    sleep(3000)
    log("启动360助手")
    launch("com.qihoo.appstore");
    sleep(18000)
    if (text("同意").exists()) {
        var qchc = text("同意").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if(className("android.widget.TextSwitcher").depth(7).indexInParent(3).exists()){
        let is_sure =className("android.widget.TextSwitcher").depth(7).indexInParent(3).findOne();
        var x = is_sure.bounds().centerX();
        var y = is_sure.bounds().centerY();
        click(x,y);
        sleep(6000);
        log("搜索")
    }
    console.show()
    setText("陌陌")
    console.hide();
    sleep(6000);
    if (text("MOMO陌陌").exists()) {
        var qchc = text("MOMO陌陌").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("下载").exists()) {
        var qchc = text("下载").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(60000)
        StaAnZMoMo()
    }
    if (text("安装").exists()) {
        StaAnZMoMo()
    }
    StaXiaMoMo()
}
//安装陌陌
function StaAnZMoMo(){
    if (text("安装").exists()) {
        var qchc = text("安装").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(60000)
    }
    if (text("完成").exists()) {
        var qchc = text("完成").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
        home();
        sleep(2000)
        let packageName = "com.immomo.momo";
        app.openAppSetting(packageName);
        console.log(packageName);
        text(app.getAppName(packageName)).waitFor();
        let is_sure = textMatches(/(.*清除数据.*|.*清除数据.*|.*清除数据.*|.*清除数据.*)/).findOne();
        if (is_sure.enabled()) {
            textMatches(/(.*清除数据.*|.*清除数据.*|.*清除数据.*|.*清除数据.*)/).findOne().click();
            textMatches(/(.*清除全部数据.*|.*清除全部数据.*)/).findOne().click();
            textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            toast(app.getAppName(packageName) + "应用已被清除全部数据");
            sleep(1000);
            back();
            sleep(1000);
            StaWeibas()
        }
    }
    if (text("打开").exists()) {
        home();
        sleep(2000)
        let packageName = "com.immomo.momo";
        app.openAppSetting(packageName);
        console.log(packageName);
        text(app.getAppName(packageName)).waitFor();
        let is_sure = textMatches(/(.*清除数据.*|.*清除数据.*|.*清除数据.*|.*清除数据.*)/).findOne();
        if (is_sure.enabled()) {
            textMatches(/(.*清除数据.*|.*清除数据.*|.*清除数据.*|.*清除数据.*)/).findOne().click();
            textMatches(/(.*清除全部数据.*|.*清除全部数据.*)/).findOne().click();
            textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            toast(app.getAppName(packageName) + "应用已被清除全部数据");
            sleep(1000);
            back();
            sleep(1000);
            StaWeibas()
        }
    }
    if (text(" 一键改机").exists()) {
        StaWeibas()
        sleep(3000)
    }
    StaAnZMoMo()
}
//第二次启动微霸，抹除APP，修改位置一系列操作
function StaWeibas(){
    launch("com.miui.miuibbs");
    sleep(16000);
    if (text(" 首页").exists()) {
        var qchc = text(" 首页").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(16000)
    }
    log("抹除APP");
    if (text(" 抹除APP").exists()) {
        var qchc = text(" 抹除APP").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        console.log("抹除APP");
        sleep(5000);
        console.hide();
        setText("信")
        sleep(3000);
        StaClerWM()
    }
    if (text(" 一键改机").exists()) {
        var qchc = text(" 一键改机").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("伪装成新设备").exists()) {
        var qchc = text("伪装成新设备").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(60000)
    }
    if (text(" 工具").exists()) {
        var qchc = text(" 工具").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("应用抹除").exists()) {
        var qchc = text("应用抹除").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
        setText("信")
        sleep(3000);
        StaClerWM();
        sleep(3000);
        StaUpdataWz();
    }
}

//修改地理位置
function StaUpdataWz(){
    var a = Text1s.toString().split("*", 20)
    toast(a.length)
    var c = Math.floor(Math.random() * a.length)
    toast(c)
    toast(a[c])
    if (text("地理位置模拟").exists()) {
        var qchc = text("地理位置模拟").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        setText(a[c]);
        //setText("兰州市汉庭酒店")
        sleep(3000)
    }
    if (text(a[c].toString()).exists()) {
        var qchc = text(a[c]).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y+68);
        sleep(3000)
    }
    if (text(" 完成").exists()) {
        var qchc = text(" 完成").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        home();
        sleep(3000)
        StaHuaShen()
    }
}
//启动花生代理text = 
function StaHuaShen(){
    launch("com.qi.earthnutproxy");
    sleep(6000);
    if (text("跳过 >").exists()) {
        var qchc = text("跳过 >").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("一键更换IP").exists()) {
        var qchc = text("一键更换IP").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        home();
        sleep(3000)
        StaRegMoMo()
    }
    sleep(3000)
    StaHuaShen()
}
//开始注册陌陌
function StaRegMoMo(){
    launch("com.immomo.momo");
    sleep(6000)
    if (text("允许").exists()) {
        var qchc = text("允许").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
    }
    if (text("同意").exists()) {
        var qchc = text("同意").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
    }
    if (className("android.widget.ImageView").depth(11).indexInParent(0).exists()) {
        var qchc = className("android.widget.ImageView").depth(11).indexInParent(0).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("去开启").exists()) {
        var qchc = text("去开启").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        if (text("登录").exists()) {
            home();
            sleep(3000);
            StaLiuB()
        }
    }
    if (text("登录").exists()) {
        StaLiuB()
    }
    StaRegMoMo()
}
//打开牛班
function StaLiuB(){
    if (text("女生").exists()) {
        var qchc = text("女生").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        StaUpdataZL()
    }
    launch("com.wantime.wbangapp.lb");
    sleep(6000)
    setText("陌陌");
    sleep(3000);
    if (text("搜索").exists()) {
        var qchc = text("搜索").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("MOMO陌陌").exists()) {
        var qchc = text("MOMO陌陌").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("一键授权").exists()) {
        var qchc = text("一键授权").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
    }
    if (text("跳过广告").exists()) {
        var qchc = text("跳过广告").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
        StaUpdataZL()
    }
    if (text("女生").exists()) {
        var qchc = text("女生").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        StaUpdataZL()
    }else{
        StaLiuB()
    }
}
//修改资料
function StaUpdataZL(){
    if (text("女生").exists()) {
        var qchc = text("女生").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    var a = Text2s.toString().split("*", 20)
    toast(a.length)
    var c = Math.floor(Math.random() * a.length)
    toast(c)
    toast(a[c])
    setText(a[c]);
    // setText(0,"飞雪")
    sleep(3000)
    if (text("选择生日").exists()) {
        var qchc = text("选择生日").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        var SjSUm=Math.round(Math.random()*10+30)
        toast(SjSUm)
        for (let index = 0; index < SjSUm; index++) {
            toast(index)
            click(218,758)
            sleep(500)
            click(418,758)
            sleep(500)
            click(688,758)
        }
        click(830,1288)
        sleep(3000)
    }
    if (text("下一步").exists()) {
        var qchc = text("下一步").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("绑定手机").exists()) {
        back();
        sleep(6000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
        StaSkip()
    }
    if (text("完成进入").exists()) {
        StaSkip()
    }
    sleep(3000);
    StaUpdataZL();
}

//陌陌跳过text = 
function StaSkip(){
    if (text("绑定手机").exists()) {
        back();
        sleep(6000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("取消").exists()) {
        var qchc = text("取消").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("更多").exists()) {
        var qchc = text("更多").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("查看或编辑个人资料").exists()) {
        var qchc = text("查看或编辑个人资料").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("下次再说").exists()) {
        var qchc = text("下次再说").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    Swipe(618, 1288, 618, 388,2000)
    sleep(3000)
    Swipe(618, 1288, 618, 388,2000)
    sleep(3000)
    if (text("Lv1").exists()) {
        var qchc = text("Lv1").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY()+88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv2").exists()) {
        var qchc = text("Lv2").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY()+88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv3").exists()) {
        var qchc = text("Lv3").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY()+88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv4").exists()) {
        var qchc = text("Lv4").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY()+88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("复制").exists()) {
        var qchc = text("复制").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x,y)
        toast(1)
        sleep(3000)
        StaWbEnd()
    }
    StaSkip()
}

function StaWbEnd(){
    home();
    sleep(3000)
    launch("com.miui.miuibbs");
    sleep(6000);
    if (text(" 多开").exists()) {
        var qchc = text(" 多开").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    setText(1,getClip())
    sleep(3000)
    setText(1,"")
    sleep(3000)
    setText(1,getClip())
    sleep(3000)
    if (text(" 一键保存").exists()) {
        var qchc = text(" 一键保存").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(60000)
    }
    if (text(" 空 ").exists()) {
        var qchc = text(" 空 ").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        log(x)
        sleep(5000)
    }
    if (text("一键切换").exists()) {
        var qchc = text("一键切换").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(30000)
        StaDkHuaS();
    }
    StaWbEnd()
}

function StaDkHuaS(){
    launch("com.qi.earthnutproxy");
    sleep(6000);
    if (text("跳过 >").exists()) {
        var qchc = text("跳过 >").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("点击断开").exists()) {
        var qchc = text("点击断开").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    StaMoMoCler()
}

//清理微信和陌陌公共（）方法
function StaClerWM(){
    if (text("微信").exists()) {
        var qchc = text("微信").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("确定").exists()) {
        var qchc = text("确定").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        setText("陌陌")
        sleep(3000)
    }
    if (text("MOMO陌陌").exists()) {
        var qchc = text("MOMO陌陌").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("确定").exists()) {
        var qchc = text("确定").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        back()
        sleep(3000)
    }
}

//启用按键监听
events.observeKey();
//监听音量下键弹起
events.onKeyDown("volume_down", function(event){
    toast("执行完毕");
    exit();
});